﻿@model IEnumerable<PlanificadorDeEventos.Models.Guest>
@{
    ViewBag.Title = "Administrador";
}

<h1>Administrador</h1>

<h2>Usuarios</h2>
<table class="bordered">
            <tr>
                <th style="padding-right:15px">
                    @Html.DisplayName("Nombre")
                </th>
                <th>
                     @Html.DisplayName("Email")
                </th>
                 <th>
                     @Html.DisplayName("Acción")
                </th>

            </tr>

        @foreach (var item in Model)
        {
                <tr>
                    <td>
                        @item.Nombre
                    </td>
                    <td>
                        @item.Email
                    </td>
                    <td>
                        @Html.ActionLink("Eliminar", null, new { id = item.ID }, new { onclick = "ShowModelPopUpUser(" + item.ID + ")" }) |
                        @Html.ActionLink("Editar", "Manage", "Account", new { idUser = item.ID }, null)
                    </td>
                    
                </tr>
        }


</table>


<h2>Eventos</h2>
<table class="bordered">
        <tr>
            <th style="padding-right:15px">
                @Html.DisplayName("Nombre")
            </th>
            <th>
                @Html.DisplayName("Descripción")
            </th>
            <th>
                @Html.DisplayName("Día")
            </th>
            <th style="padding-left:15px">
                @Html.DisplayName("Final de inscripción")
            </th>
            <th style="padding-left:15px">
                @Html.DisplayName("Acción")
            </th>
        </tr>

    @foreach (var evento in ViewBag.Eventos)
    {
        <tr>
            <td>
                @evento.Nombre
            </td>
            <td>
                @evento.Description
            </td>
            <td>
                @evento.Date
            </td>
            <td style="padding-left:15px">
                @evento.EndRegistrationDate
            </td>
            <td>
                @Html.ActionLink("Editar", "Edit", new { id = evento.ID }) |
                @Html.ActionLink("Detalles", "Details", new { id = evento.ID }) |
                @Html.ActionLink("Eliminar", null, new { id = evento.ID }, new { onclick = "ShowModelPopUpEvento(" + evento.ID + ")" })
           </td>
    
        </tr>
    }

    </table>

<script type="text/javascript">
    ShowModelPopUpUser = function (id) {
        window.showModalDialog('/Evento/EliminarUsuario?idUser=' + id, "WindowPopup", 'dialogWidth:400px; dialogHeight:200px; resizable:0; center:1;');
    }

    ShowModelPopUpEvento = function (id) {
        window.showModalDialog('/Evento/Delete?id=' + id, "WindowPopup", 'dialogWidth:400px; dialogHeight:200px; resizable:0; center:1;');
    }
</script>